.chip-group-container {
  width: 100%;
  max-width: 400px;
  margin: 20px auto;
  padding: 16px;
  border-radius: 4px;
  transition: box-shadow 0.3s ease;
  min-width: 0;
}

.chip-grid-container {
  width: 100%;
  overflow-x: auto;
  padding: 8px 0;

    /* Hide scrollbar for aesthetic purposes, but keep functionality */
  &::-webkit-scrollbar {
    height: 8px;
  }
  &::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 10px;
  }
  &::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 10px;
  }
  &::-webkit-scrollbar-thumb:hover {
    background: #888;
    border-radius: 3px;

    &:hover {
      background: #555;
    }
  }
}

.chip-scroll-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-bottom: 8px;
}

::ng-deep {
  .mat-mdc-form-field {
    width: 100%;
    margin-top: 8px;

    .mat-mdc-form-field-flex {
      padding: 0 8px;
    }

    .mat-mdc-form-field-infix {
      padding: 8px 0;
    }

    .mat-mdc-form-field-subscript-wrapper {
      display: none;
    }

    .mat-mdc-chip-grid {
      display: flex !important;
      flex-wrap: nowrap !important;
      gap: 8px;
      min-height: 32px;
      width: 100%;
      max-width: 100%;
      min-width: 0;
    }

    .mat-mdc-chip-row {
      flex-shrink: 0;
      white-space: nowrap;
      margin: 0;
      cursor: pointer;
      transition: transform 0.2s ease;

      &:hover {
        transform: translateY(-1px);
      }

      &.mat-mdc-chip-selected {
        background-color: #e0e0e0;
      }

      .mdc-evolution-chip__action--primary {
        padding: 0 8px;
      }

      .mdc-evolution-chip__text-label {
        font-size: 14px;
        white-space: nowrap;
      }

      .mat-mdc-chip-remove {
        opacity: 0.6;
        transition: opacity 0.2s ease;

        &:hover {
          opacity: 1;
        }
      }
    }

    input[matChipInputFor] {
      width: auto !important;
      min-width: 120px;
      flex: 0 0 auto;
      display: inline-block;
      vertical-align: middle;
    }
  }

  .mat-mdc-autocomplete-panel {
    .mat-mdc-option {
      font-size: 14px;
      height: 32px;
      line-height: 32px;
    }
  }
}

.chip-input {
  width: auto !important;
  min-width: 120px;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: middle;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  margin-left: 4px;
}

.plain-chip-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 16px 12px 8px 12px;
  border: 2px solid rgba(0,0,0,0.23);
  border-radius: 4px;
  background: #fff;
  align-items: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  position: relative;
}

.plain-chip-row:focus-within {
  border-color: #30708e;
  box-shadow: 0 0 0 2px rgba(63,81,181,0.15);
}

.chip-outline-field {
  position: relative;
  margin-top: 24px;
}

.chip-outline-label {
  position: absolute;
  top: -12px;
  left: 12px;
  background: #fff;
  padding: 0 4px;
  font-size: 13px;
  color: rgba(0,0,0,0.6);
  transition: color 0.2s;
  pointer-events: none;
  z-index: 1;
}

.chip-outline-field:focus-within .chip-outline-label {
  color: #30708e;
}

.chip-outline-label.floated {
  color: #30708e;
}

.plain-chip-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 16px 12px 8px 12px;
  border: 2px solid rgba(0,0,0,0.23);
  border-radius: 4px;
  background: #fff;
  align-items: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  position: relative;
}

